import 'package:self32/generated/json/base/json_convert_content.dart';
import 'package:self32/entity/reader_entity.dart';

ReaderEntity $ReaderEntityFromJson(Map<String, dynamic> json) {
	final ReaderEntity readerEntity = ReaderEntity();
	final bool? validReader = jsonConvert.convert<bool>(json['valid_reader']);
	if (validReader != null) {
		readerEntity.validReader = validReader;
	}
	final bool? validPassword = jsonConvert.convert<bool>(json['valid_password']);
	if (validPassword != null) {
		readerEntity.validPassword = validPassword;
	}
	final String? no = jsonConvert.convert<String>(json['no']);
	if (no != null) {
		readerEntity.no = no;
	}
	final String? name = jsonConvert.convert<String>(json['name']);
	if (name != null) {
		readerEntity.name = name;
	}
	final dynamic? icrNo = jsonConvert.convert<dynamic>(json['icr_no']);
	if (icrNo != null) {
		readerEntity.icrNo = icrNo;
	}
	final String? stateValue = jsonConvert.convert<String>(json['state_value']);
	if (stateValue != null) {
		readerEntity.stateValue = stateValue;
	}
	final int? limitCount = jsonConvert.convert<int>(json['limit_count']);
	if (limitCount != null) {
		readerEntity.limitCount = limitCount;
	}
	final int? limitDays = jsonConvert.convert<int>(json['limit_days']);
	if (limitDays != null) {
		readerEntity.limitDays = limitDays;
	}
	final String? org = jsonConvert.convert<String>(json['org']);
	if (org != null) {
		readerEntity.org = org;
	}
	final int? currentBorrowCount = jsonConvert.convert<int>(json['current_borrow_count']);
	if (currentBorrowCount != null) {
		readerEntity.currentBorrowCount = currentBorrowCount;
	}
	final List<ReaderCurrentBorrowList>? currentBorrowList = jsonConvert.convertListNotNull<ReaderCurrentBorrowList>(json['current_borrow_list']);
	if (currentBorrowList != null) {
		readerEntity.currentBorrowList = currentBorrowList;
	}
	return readerEntity;
}

Map<String, dynamic> $ReaderEntityToJson(ReaderEntity entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['valid_reader'] = entity.validReader;
	data['valid_password'] = entity.validPassword;
	data['no'] = entity.no;
	data['name'] = entity.name;
	data['icr_no'] = entity.icrNo;
	data['state_value'] = entity.stateValue;
	data['limit_count'] = entity.limitCount;
	data['limit_days'] = entity.limitDays;
	data['org'] = entity.org;
	data['current_borrow_count'] = entity.currentBorrowCount;
	data['current_borrow_list'] =  entity.currentBorrowList?.map((v) => v.toJson()).toList();
	return data;
}

ReaderCurrentBorrowList $ReaderCurrentBorrowListFromJson(Map<String, dynamic> json) {
	final ReaderCurrentBorrowList readerCurrentBorrowList = ReaderCurrentBorrowList();
	final String? bookNo = jsonConvert.convert<String>(json['book_no']);
	if (bookNo != null) {
		readerCurrentBorrowList.bookNo = bookNo;
	}
	final String? bookTitle = jsonConvert.convert<String>(json['book_title']);
	if (bookTitle != null) {
		readerCurrentBorrowList.bookTitle = bookTitle;
	}
	final String? readyReturnDate = jsonConvert.convert<String>(json['ready_return_date']);
	if (readyReturnDate != null) {
		readerCurrentBorrowList.readyReturnDate = readyReturnDate;
	}
	final bool? overdue = jsonConvert.convert<bool>(json['overdue']);
	if (overdue != null) {
		readerCurrentBorrowList.overdue = overdue;
	}
	final int? status = jsonConvert.convert<int>(json['status']);
	if (status != null) {
		readerCurrentBorrowList.status = status;
	}
	final String? error = jsonConvert.convert<String>(json['error']);
	if (error != null) {
		readerCurrentBorrowList.error = error;
	}
	return readerCurrentBorrowList;
}

Map<String, dynamic> $ReaderCurrentBorrowListToJson(ReaderCurrentBorrowList entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['book_no'] = entity.bookNo;
	data['book_title'] = entity.bookTitle;
	data['ready_return_date'] = entity.readyReturnDate;
	data['overdue'] = entity.overdue;
	data['status'] = entity.status;
	data['error'] = entity.error;
	return data;
}